//package dw.fastfile.common.interceptor;
//
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.web.servlet.AsyncHandlerInterceptor;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * @description:
// * @author: wanghao
// * @create: 2024-01-30 18:08
// **/
//@Slf4j
//public class HandleDict implements AsyncHandlerInterceptor {
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
////        String jsonStr =  request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
////        ObjectMapper objectMapper = new ObjectMapper();
////        JsonNode rootNode = objectMapper.readTree(jsonStr);
////        List<DictValidationResult> validationResults = new ArrayList<>();
////
////        for (JsonNode fieldNode : rootNode) {
////            if (fieldNode.has("dict")) {
////                String dictType = fieldNode.get("dict").asText();
////                JsonNode valueNode = fieldNode.get("value");
////                if (valueNode != null && !valueNode.isNull()) {
////                    String value = valueNode.asText();
////                    DictValidationResult validationResult = dictService.validate(dictType, value);
////                    if (!validationResult.isValid()) {
////                        validationResults.add(validationResult);
////                    }
////                }
////            }
////        }
//
////        if (!validationResults.isEmpty()) {
////            response.setStatus(HttpStatus.BAD_REQUEST.value());
////            response.setContentType(MediaType.APPLICATION_JSON_VALUE);
////            objectMapper.writeValue(response.getWriter(), validationResults);
////            return false;
////        }
//        return true;
//
//
//    }
//}
